fix(gatsby-transformer-react-docgen): support schema rebuilding #20095
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Schema rebuilding introduced in #19092 requires fresh instances of GraphQL types on each rebuild. So plugins using
setFieldsOnGraphQLNodeType
orcreateSchemaCustomization
APIs with original graphql.js types must provide new type instances on each API call.This is an unfortunate restriction caused by
graphql-compose
design which mutates types under the hood. Therefore we can not reliably re-use old types for a new schema.This issue doesn't apply to plugins using SDL or type builders to define GraphQL types as we produce fresh type instances for them automatically.
Related Issues
Fixes #20043